import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Text1 {
    public static void main(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        try (BufferedReader reader = new BufferedReader(
                new InputStreamReader(new FileInputStream("文件1.txt"), "UTF-8"))) {
            String line;
            while ((line = reader.readLine()) != null) {
                stringBuilder.append(line).append("\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        String fiedData = stringBuilder.toString().toUpperCase();
        try (BufferedWriter writer = new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream("文件2.txt"), "UTF-8"))) {
            writer.write(fiedData);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try (BufferedReader reader1 = new BufferedReader(
                new InputStreamReader(new FileInputStream("文件2.txt"), "UTF-8"))) {
            String line;
            while ((line = reader1.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
